﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Demo
{
    public partial class DemoTimer : Form
    {
        public DemoTimer()
        {
            InitializeComponent();
        }

        private int i = 10;
        private void button1_Click(object sender, EventArgs e)
        {
            //timer1.Enabled = true;
            timer1.Start();
        }

        private void DemoTimer_Load(object sender, EventArgs e)
        {
            label1.Text = i.ToString();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (i > 0)
                label1.Text = (--i).ToString();

            if (i == 0)
                timer1.Stop();
        }
    }
}
